package com.wcy.feign.resource;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wcy.entity.LearningResource;
import com.wcy.entity.queryVo.QueryConvertor;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@FeignClient(name = "cloud-provider-resource", contextId = "FeignLearningResourceService")
public interface FeignLearningResourceService {
    //学习资源
    @GetMapping("learningResource/page")
    public ResponseEntity<Page<LearningResource>> getPage(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
                                                          @RequestParam(name = "pageSize",defaultValue = "10") int pageSize);
    @GetMapping("learningResource/listWithIds")
    public ResponseEntity<List<LearningResource>> getListWithIds(@RequestBody List<Integer> ids);

    @GetMapping("learningResource/list")
    public ResponseEntity<List<LearningResource>> getList() ;

    @GetMapping("learningResource/{id}")
    public ResponseEntity<LearningResource> get(@PathVariable("id") Integer id);

    @PostMapping("learningResource/add")
    public ResponseEntity<Void> add(@RequestBody LearningResource learningResource) ;

    @PutMapping("learningResource/update")
    public ResponseEntity<Void> update(@RequestBody LearningResource learningResource) ;

    @DeleteMapping("learningResource/delete/{id}")
    public ResponseEntity<Void> delete(@PathVariable("id") Integer id) ;

    @GetMapping("learningResource/user/page")
    public ResponseEntity<Page<LearningResource>> getPageAuthor(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                                                @RequestParam(value = "pageSize",defaultValue = "10") int pageSize) ;

    @PutMapping("learningResource/user/update")
    public ResponseEntity<Void> updateByAuthor(@RequestBody LearningResource learningResource);

    @DeleteMapping("learningResource/user/delete/{id}")
    public ResponseEntity<Void> deleteByAuthor(@PathVariable("id") Integer id);

    @PostMapping("learningResource/user/add")
    public ResponseEntity<Void> addByAuthor(@RequestBody LearningResource learningResource);

    @GetMapping("learningResource/getByAuthor/{id}")
    public ResponseEntity<List<LearningResource>> getByAuthor(@PathVariable("id") Integer id);

    @PostMapping("learningResource/listByIds")
    public ResponseEntity<List<LearningResource>> getListByIds(@RequestBody List<Integer> ids);
}
